class Game
{
	private static final int FIRST = 1;
	private static final int SECOND = 2;
	private static final int EMPTY = 0;

	private int [][] area;
	private int width;
	private int height;

	private int lastToH;
	private int lastToW;

	public Game()
	{
		width = 3;
		height = 3;

		area = new int[width][height];

		for(int i = 0; i < width; i++)
		{
			area[0][i] = FIRST;
			area[height-1][i] = SECOND;
		}
	}

	public boolean doStepForward(int fromH, int fromW)
	{
		int delta;
		switch(area[fromH][fromW])
		{
			case FIRST:
			{
				delta = 1;
				break;
			}
			case SECOND:
			{
				delta = -1;
				break;
			}
			default:
			{
				return false;
			}
		}
		
		if(area[fromH + delta][fromW] != EMPTY)
		{
			return false;
		}
		area[fromH + delta][fromW] = area[fromH][fromW];
		area[fromH][fromW] = EMPTY;
		return true;
	}	
}